/** Test Main function 3
 *
 *  Test Main function 3. Test the LogRecorder.
 *
 *  @author : huicong
 *  @date : 2008-10-29
 *
 */

#include "BCMI_Frame.h"
#include "BasicHeader.h"
#include "LogRecorder.h"
#include "FrameClock.h"

#include <iostream>

using namespace std;
using namespace bcmi_frame;

INT main3(INT argc, CSTRING *argv)
{
    MPI_Init(&argc, &argv);
    cout << __FUNCTION__ << endl;
    cout << "Test Log start : testLog.txt" << endl;
    FrameClock _clock;
    LogRecorder logger("testLog.txt", &_clock);
    INT a = 1;
    for (UINT j = 0; j < 100; ++j)
    {
        for (UINT i = 0; i < 10000000; ++i)
        {
            //SLEEP
            a = ( a + a ) % ((a / 2) + 1);
        }
    }
    cout << a << endl;
    logger.log("123");
    logger.log("456");
    logger.log("789");
    logger.log("456");
    logger.log("123");
    logger.log(H_E_MPI_WRITER_BUFFER_LACK, bcmi_frame::MPI, "test", "logtest", 7);
    cout << "Test Log end : testLog.txt" << endl;
    MPI_Finalize();
    return 0;
}